import React, { Component } from 'react'
import './App.css'
import MyRoute from './MyRoute'
import axios from 'axios'
export default class App extends Component {
  state = {
    cityList: []
  }
  componentDidMount () {
    //请求接口 返回数据
    axios.get('/city').then((res) => {
      const { data: { list } } = res
      console.log(res.data.list, 'data')
      this.setState({
        cityList: list
      })
    })
  }
  render () {
    const { cityList } = this.state
    return (
      <div>
        <MyRoute cityList={cityList}></MyRoute>
      </div>
    )
  }
}

